package com.bcinfo.iccard.util;

import java.text.SimpleDateFormat;
import java.util.Date;
/**
 * 日期格式化工具
 * @author wangguangchun
 *
 */
public class DateTimeUtils {
	private static final SimpleDateFormat yyyyMMdd = new SimpleDateFormat(
			"yyyyMMdd");
	private static final SimpleDateFormat hhMMss = new SimpleDateFormat(
			"HHmmss");

	public static String getYearMonthDay() {
		return yyyyMMdd.format(new Date());
	}

	public static String getHourMinuteSec() {
		return hhMMss.format(new Date());
	}
	
	public static String getDateTime(Date date,String format){
		if(date==null){
			date=new Date();
		}
		SimpleDateFormat sdf=new SimpleDateFormat(format);
		return sdf.format(date);
	}
	public static void main(String[] args)
    {
        System.out.println(System.currentTimeMillis());
    }
}
